using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace InvestmentIntelligence.DbModel.Models
{
    using System.ComponentModel.DataAnnotations.Schema;

    using InvestmentIntelligence.DB.Atributes;

    public class Trade
    {


        [Key]
        [IgnoreOnMerge]
        public int Id { get; set; }

        public decimal Quantity { get; set; }
        public decimal? Price { get; set; }
        public decimal? Size { get; set; }
        public int SecurityId { get; set; }
        public int FundBookEntityId { get; set; }        
        public DateTime Date { get; set; }
        public int TraderId { get; set; }
        public int? StrategyId { get; set; }
        public int CurrencyId { get; set; }
        public decimal? FxRate { get; set; }

        [Key]
        public string OriginalId { get; set; }

        public string AdditionalData { get; set; }

        [ForeignKey("SecurityId")]
        public virtual Security Security { get; set; }
        
        [ForeignKey("FundBookEntityId")]
        public virtual FundBookEntity FundBookEntity { get; set; }
        
        [ForeignKey("CurrencyId")]
        public virtual Currency Currency { get; set; }

        public override string ToString()
        {
            return string.Format("Id: {0}, Quantity: {1}, Price: {2}, SecurityId: {3}, FundBookEntityId: {4}, Date: {5}, TraderId: {6}, StrategyId: {7}, CurrencyId: {8}, FxRate: {9}, OriginalId: {10}, AdditionalData: {11}, Size: {12}", Id, Quantity, Price, SecurityId, FundBookEntityId, Date, TraderId, StrategyId, CurrencyId, FxRate, OriginalId, AdditionalData, Size);
        }
    }

    public class MiniTrade
    {
        public int SecurityId { get; set; }
        public DateTime Date { get; set; }
        public decimal? SizeOverCapital { get; set; }

        public string SecurityName { get; set; }
    }
}
